package com.jiemengshi.server.util;

import java.util.HashMap;
import java.util.Map;

public class ErrorCodeMsg {
	public static Map<Integer, String> errMsg = new HashMap<Integer, String>();
	
	//1开头为系统类错误
	public static int SYSTEM_ERROR = 10000;
	public static int OPERATION_FAIL = 10001;
	public static int PARAMETER_ERROR = 10002;
	
	//2为用户类错误
	public static int USER_WECHAT_LOGIN_CODE_ERROR = 20000;
	public static int USER_WECHAT_LOGIN_FAIL = 20001;
	public static int USER_WECHAT_NOT_LOGIN = 20002;
	public static int USER_WECHAT_UPDATE_FAIL = 20003;
	public static int USER_ADMIN_LOGIN_FAIL = 20004;
	public static int USER_ADMIN_NOT_LOGIN = 20005;
	public static int USER_ADMIN_NO_AUTHORITY = 20006;
	public static int USER_NOT_LOGIN = 20007;
	
	//3为梦境类
	public static int DREAM_ANALYZE_KEYWORD_EMPTY = 30000;
	public static int DREAM_RECORD_ADD_FAIL = 30001;
	public static int DREAM_RECORD_UPDATE_FAIL = 30002;
	public static int DREAM_RECORD_ID_ERROR = 30003;
	public static int DREAM_RECORD_TITLE_ERROR = 30004;
	public static int DREAM_RECORD_CONTENT_ERROR = 30005;
	public static int DREAM_REPLY_ADD_ERROR = 30006;
	public static int DREAM_REPLY_CONTENT_ERROR = 30007;
	public static int DREAM_REPLY_DELETE_ERROR = 30006;

	//4为七牛错误
	public static int ATTACHMENT_SAVE_ERROR = 40000;
	
	//5为反馈错误
	public static int FEEDBACK_ADD_ERROR = 50000;
	public static int FEEDBACK_CONTENT_EMPTY = 50001;
	public static int FEEDBACK_ID_ERROR = 50002;
	
	//6为微信相关的错误
    public static int WECHAT_USER_NO_AVAILABLE_FORMID = 60000;
    
	static {
		errMsg.put(SYSTEM_ERROR, "系统忙碌");
		errMsg.put(OPERATION_FAIL, "操作失败");
		errMsg.put(PARAMETER_ERROR, "参数错误");
		
		errMsg.put(USER_WECHAT_LOGIN_CODE_ERROR, "登录错误，请检查code等相关参数");
		errMsg.put(USER_WECHAT_LOGIN_FAIL, "登录失败，请重试");
		errMsg.put(USER_WECHAT_NOT_LOGIN, "用户未登录");
		errMsg.put(USER_WECHAT_UPDATE_FAIL, "用户信息更新失败");
		errMsg.put(USER_ADMIN_LOGIN_FAIL, "登录失败，请检查用户名或密码");
		errMsg.put(USER_ADMIN_NOT_LOGIN, "用户未登录");
		errMsg.put(USER_ADMIN_NO_AUTHORITY, "用户没有权限");
		errMsg.put(USER_NOT_LOGIN, "用户未登录");
		
		errMsg.put(DREAM_ANALYZE_KEYWORD_EMPTY, "关键字为空");
		errMsg.put(DREAM_RECORD_ADD_FAIL, "梦境添加失败");
		errMsg.put(DREAM_RECORD_UPDATE_FAIL, "梦境更新失败");
		errMsg.put(DREAM_RECORD_ID_ERROR, "梦境记录id错误");
		errMsg.put(DREAM_RECORD_TITLE_ERROR, "梦境记录标题错误");
		errMsg.put(DREAM_RECORD_CONTENT_ERROR, "梦境记录内容为空");
		errMsg.put(DREAM_REPLY_ADD_ERROR, "梦境回复添加错误");
		errMsg.put(DREAM_REPLY_CONTENT_ERROR, "梦境回复内容为空");
		errMsg.put(DREAM_REPLY_DELETE_ERROR, "梦境回复删除错误");
		
		errMsg.put(ATTACHMENT_SAVE_ERROR, "附件保存错误");
		
		errMsg.put(FEEDBACK_ADD_ERROR, "添加反馈错误");
		errMsg.put(FEEDBACK_CONTENT_EMPTY, "反馈内容为空");
		errMsg.put(FEEDBACK_ID_ERROR, "反馈ID错误");
		
		errMsg.put(WECHAT_USER_NO_AVAILABLE_FORMID, "用户没有可用的formId");
	}
	
	public static String getErrorMsg(int code){
		return errMsg.get(code);
	}
}
